<?php
	namespace app\controllers\captcha;
	use yii\web\Controller;
	use app\models\captcha\code;//刚刚定义的验证码model
	class CodeController extends Controller{
		//action为验证码验证的方法
		public function actions(){
			return [
				'captcha'=>[
					//验证的类
					'class'=>'yii\captcha\CaptchaAction',
					//验证码最大个数
					'maxLength'=>4,
					//最小个数
					'minLength'=>4,
					//验证码宽度
					'width'=>80,
					//验证码高度
					'height'=>40,
				],
			];
		}
		public function actionIndex(){
			$code = new code;
			return $this->render('code',['code'=>$code]);
		}
	}
?>